package com.nuc.bigdata.exception;

import com.nuc.bigdata.model.Result;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * @author JackLuo
 * @date 2019/10/31
 */
@ControllerAdvice
@ResponseBody
public class UserExceptionHandler {

    @ResponseStatus(HttpStatus.OK)
    @ExceptionHandler({BusinessException.class})
    public Result userServiceExceptionHandler(BusinessException be){
        return new Result(be.getCode(),be.getMsg() ,be.getError() );
    }
}
